﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BackOffice.Master" AutoEventWireup="true" CodeBehind="Member_Sales_Report.aspx.cs" Inherits="FYPDemo.Member_Sales_Report" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table>
        <tr>
            <td>
                <asp:Label ID="lblMember" runat="server" Text="Member"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtMember" runat="server"></asp:TextBox>
            </td>
        </tr>
        
        <tr>
            <td>
                <asp:Label ID="lblPaidFrom" runat="server" Text="Paid From"></asp:Label>
            </td>

            <td>
                <asp:TextBox ID="txtPaidFrom" runat="server"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtPaidFrom"
                Format="yyyy-MM-dd" Enabled ="true">
                </asp:CalendarExtender>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="lblPaidTo" runat="server" Text="Paid To"></asp:Label>
            </td>

            <td>
                <asp:TextBox ID="txtPaidTo" runat="server"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtPaidTo"
                Format="yyyy-MM-dd" Enabled ="true">
                </asp:CalendarExtender>
            </td>
        </tr>       

        <tr>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="Search" 
                    onclick="btnSearch_Click" />
            </td>
            <td>
                <asp:Button ID="btnExport" runat="server" Text="Export" 
                    onclick="btnExport_Click" />
            </td>
        </tr>
    
    </table>

    <asp:GridView ID="MemberSalesReport_Grid" runat="server" AutoGenerateColumns="False" OnRowCommand="MemberSales_Command" DataKeyNames="OrderID" >
        <Columns>
            <asp:TemplateField HeaderText = "No.">
                <ItemTemplate>
                    <%# Container.DataItemIndex + 1 %>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "Member">
                <ItemTemplate>
                    <asp:Label ID="lblMember" runat="server"><%#Eval("Name") %></asp:Label>
                </ItemTemplate> 
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "Order ID">
                <ItemTemplate>
                    
                    <asp:LinkButton ID="lblOrderID" runat="server" Text='<%#Eval("OrderID") %>'
                    CommandArgument = "<%# ((GridViewRow) Container).RowIndex  %>" CommandName = "OrderID" ></asp:LinkButton>
                </ItemTemplate> 
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "Total Price">
                <ItemTemplate>
                    <asp:Label ID="lblTotalPrice" runat="server"><%#Eval("TotalPrice") %></asp:Label>
                </ItemTemplate> 
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "Order Date">
                <ItemTemplate>
                    <asp:Label ID="lblDateCreated" runat="server"><%#Eval("DateCreated") %></asp:Label>
                </ItemTemplate> 
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "Paid Date">
                <ItemTemplate>
                    <asp:Label ID="lblDatePaid" runat="server"><%#Eval("DatePaid") %></asp:Label>
                </ItemTemplate> 
            </asp:TemplateField>            
        </Columns>
    </asp:GridView>

    <asp:Label ID="lblText" runat="server" Text="Total Member: "></asp:Label>&nbsp;&nbsp;
    <asp:Label ID="lblMemberCount" runat="server"></asp:Label>

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
</asp:Content>
